﻿using BasicInformation.API.Application.Command.FuelCostsCommand;
using BasicInformation.API.Application.Command.OutsourcingCommand;
using BasicInformation.API.Application.Command.OwnerCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace BasicInformation.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class FuelCostsController : ControllerBase
    {
        private readonly IMediator mediator;

        public FuelCostsController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 油费新增
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<int> FuelCostsAdd(FuelCostsCreateCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 油费删除
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<int> FuelCostsDelete([FromQuery] FuelCostsDeleteCommand command)
        {
            return await mediator.Send(command);
        }
        /// <summary>
        /// 油费批量删除
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<int> FuelCostsBatchDelete([FromQuery] FuelCostsBatchDeleteCommand command)
        {
            return await mediator.Send(command);
        }

        /// <summary>
        /// 油费修改
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<int> FuelCostsUpdate(FuelCostsUpdateCommand command)
        {
            return await mediator.Send(command);
        }
    }
}
